<template>
  <section class="my-container">
    <CarRentalSelect :getTypeList="getType" />
    <el-row :gutter="24">
      <CarCard v-for="type in typeList" :key="type._id" :car="type" />
    </el-row>
  </section>
</template>

<script>
  export default {
    name: 'CarRental',
    data() {
      return {}
    },
    computed: {
      ...mapState('type', ['typeList']),
      ...mapState('category', ['carId']),
      categoryId() {
        return this.$route.params.categoryId
      },
    },
    mounted() {
      this.getType(this.categoryId)
    },
    methods: {
      ...mapActions('type', ['getType']),
    },
  }
</script>

<style scoped></style>
